<template>
  <div class="app-container">
    <div class="content">
      <!-- <div class="header">
        <span class="hname">账号:</span
        ><el-input v-model="input" placeholder="请输入个人账号"></el-input>
        <el-button type="warning">查询</el-button>
      </div> -->
      <div class="logoBox">
        <img src="@/assets/images/logo.png" alt="" />
      </div>
      <div class="rightHeader">
        <div class="header">
          <el-form
            :model="queryParams"
            ref="queryForm"
            size="large"
            :inline="true"
            label-width="125px"
          >
            <el-form-item label="货主:" prop="skuDescr1" class="Owner">
              <el-input
                v-model="queryParams.skuDescr1"
                placeholder="请选择货主名称"
                clearable
                @keyup.enter.native="handleQuery"
              />
              <i class="el-icon-more custom-icon" @click="showTable"></i>
            </el-form-item>
            <el-form-item label="货权方:" prop="hz">
              <el-select
                v-model="queryParams.codeDescr"
                placeholder="请选择货权方"
                clearable
              >
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.label"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="商品编码:" prop="lotAtt04">
              <el-input
                v-model="queryParams.lotAtt04"
                placeholder="请输入商品编码"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="商品缩写:" prop="skuDescr11">
              <el-input
                v-model="queryParams.skuDescr11"
                placeholder="请输入商品缩写"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="药品名称:" prop="skuDescr12">
              <el-input
                v-model="queryParams.skuDescr12"
                placeholder="请输入药品名称"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="批号:" prop="skuDescr13">
              <el-input
                v-model="queryParams.skuDescr13"
                placeholder="请输入批号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="产品代码:" prop="skuDescr21">
              <el-input
                v-model="queryParams.skuDescr21"
                placeholder="请输入产品代码"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="收货时间:" prop="lotAtt04">
              <el-date-picker
               style="width:380px"
                end-placeholder="结束日期"
                range-separator="-"
                start-placeholder="开始日期"
                type="datetimerange"
                v-model="value3"
                :default-time="['00:00:00', '23:59:59']"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item class="searchButton">
              <el-button
                type="primary"
                icon="el-icon-search"
                size="small"
                @click="handleQuery"
                >搜索</el-button
              >
              <el-button
                type="primary"
                icon="el-icon-refresh"
                size="small"
                @click="resetQuery"
                >重置</el-button
              >
              <div class="footer">
                <img src="@/assets/images/back.png" alt="" @click="goBack" />
                <span @click="goBack">退出</span>
              </div>
            </el-form-item>
          </el-form>
        </div>
      </div>
      <!-- 810 -->
      <div class="wtable">
        <el-table
          :data="tableData"
          class="tableContent"
          height="760"
          v-loading="loading"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.8)"
          ><el-table-column
            fixed
            prop="hz"
            label="货主"
            width="150"
            align="center"
          >
          </el-table-column>
          <el-table-column
            fixed
            prop="sku"
            label="货权方"
            width="150"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="skuDescr1"
            label="收货时间"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="alternateSku3"
            label="业务单据编号"
            width="150"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAvailed"
            label="供应商"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="alternateSku4"
            label="收货状态"
            width="200"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="lotAtt04"
            label="SKU"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="lotAtt04"
            label="商品名称"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="lotAtt04"
            label="商品编码"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="locationId"
            label="规格"
            width="150"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="dw"
            label="生产厂家"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column prop="zl" label="已收数量" width="150" align="center">
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="收货员"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="录入员"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="验收员"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="验收状态"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="验收单数量"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="验收单位"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="批号"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="生产日期"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="有效期"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="上架货位"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="上架单位"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="上架数量"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="上架员"
            width="180"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="qtyAllocated"
            label="上架时间"
            width="180"
            align="center"
          >
          </el-table-column>
        </el-table>
        <div>
          <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="handleQuery"
          />
        </div>
      </div>
    </div>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      @close="dialogVisible = false"
    >
      <span>未查询到数据</span>
    </el-dialog>
    <ownerDig
      :dialogTableVisible="dialogTableVisible"
      @closeDialog="dialogcloseTab"
      @submitValue="submitfuValue"
    ></ownerDig>
  </div>
</template>

<script>
// import { getInventory } from "@/api/subSystem/continer";
import ownerDig from "@/components/invenTrans/Owner";
export default {
  components: {
    ownerDig,
  },
  data() {
    return {
      dialogTableVisible: false,
      value3: "",
      options: [],
      // 弹窗隐藏
      dialogVisible: false,
      // 总条数
      total: 0,
      //点击表格传的值
      nameData: "",
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        skuDescr1: null,
        skuDescr2: null,
        lotAtt04: null,
        locationId: null,
        alternateSku2: null,
        hz: null,
      },
      // queryRules: {
      //   skuDescr1: [
      //     { required: true, message: "请输入商品名称", trigger: "blur" },
      //     { min: 5, trigger: "blur" },
      //   ],
      //   lotAtt04: [
      //     { required: true, message: "请输入批号", trigger: "blur" },
      //     { min: 5, trigger: "blur" },
      //   ],
      //   locationId: [
      //     { required: true, message: "请输入库位", trigger: "blur" },
      //     { min: 5, trigger: "blur" },
      //   ],
      //   alternateSku2: [
      //     { required: true, message: "请输入69码", trigger: "blur" },
      //     { min: 5, trigger: "blur" },
      //   ],
      // },
      initialTableData: [], // 初始状态的表格数据
      tableData: [],
    };
  },
  methods: {
    submitfuValue(w) {
      this.queryParams.skuDescr1 = w.name;
    },
    dialogcloseTab(v) {
      this.dialogTableVisible = v;
    },
    showTable() {
      this.dialogTableVisible = true;
      console.log(1);
    },
    resetQuery() {
      this.tableData = [...this.initialTableData];
      this.queryParams.skuDescr1 = "";
      this.queryParams.lotAtt04 = "";
      this.queryParams.locationId = "";
      this.queryParams.alternateSku2 = "";
      this.queryParams.hz = "";
    },
    goBack() {
      this.$router.push("/subSystem1");
    },
    handleQuery() {
      if (
        this.queryParams.skuDescr1 ||
        this.queryParams.lotAtt04 ||
        this.queryParams.locationId ||
        this.queryParams.alternateSku2 ||
        this.queryParams.hz
      ) {
        // this.loading = true;
        // getInventory(this.queryParams)
        //   .then((res) => {
        //     if (Array.isArray(res.rows) && res.rows.length > 0) {
        //       this.tableData = res.rows;
        //       this.total = res.total;
        //       this.loading = false;
        //     } else {
        //       this.dialogVisible = true;
        //       this.loading = false;
        //     }
        //   })
        //   .catch((error) => {
        //     this.loading = false;
        //   });
      } else {
        this.$message.error("请先填写搜索条件");
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  padding: 0 !important;
  width: 100%;
  height: 100%;
  background: url("~@/assets/images/bg.png") no-repeat;
  overflow: hidden;
  ::v-deep .el-form-item__label {
    color: #fff;
    font-size: 16px;
    font-weight: 400;
  }
  ::v-deep .el-input--small .el-input__inner {
    height: 40px;
  }
  ::v-deep .el-pagination__jump {
    color: #ffffff;
  }
  ::v-deep .el-pagination__total {
    color: #ffffff;
  }
  ::v-deep .el-pagination {
    margin-right: 78px;
  }
  .pagination-container {
    background: transparent;
    padding: 0px 20px !important;
    margin-top: 5px !important;
  }
  .content {
    height: 100%;
  }
  .logoBox {
    width: 200px;
    margin-left: 15px;
    img {
      width: 200%;
    }
  }
  .rightHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-left: 90px;
    margin-top: -15px;
    .header {
      .footer {
        display: flex;
        align-items: center;
        cursor: pointer;
        margin-top: -50px;
        margin-left: 200px;
        color: #ffffff5d;
        font-size: 18px;
        img {
          width: 30%;
        }
        span {
          display: block;
          margin-left: -40px;
          margin-top: 15px;
          font-size: 12px;
        }
      }
    }
  }
  .hname {
    width: 40px;
  }
  .el-button--medium {
    margin-left: 10px;
    font-size: 18px;
  }
  .wtable {
    width: 100%;
    text-align: center;
  }
  .tableContent {
    margin: 0 auto;
    width: 96%;
    margin-top: 0px;
  }
  ::v-deep .el-form-item__label {
    color: #fff;
  }
  ::v-deep .el-input {
    width: 90%;
    font-size: 16px;
  }
  ::v-deep .el-dialog:not(.is-fullscreen) {
    margin-top: 40vh !important;
  }
  ::v-deep .el-input--suffix .el-input__inner {
    padding-right: 0px;
  }
  ::v-deep .el-pagination.is-background .btn-next:disabled {
    color: #797a7b;
  }
  ::v-deep .el-pagination.is-background .btn-prev:disabled {
    color: #797a7b;
  }
  ::v-deep .el-pagination span:not([class*="suffix"]) {
    min-width: 56.5px;
  }
  ::v-deep .el-form--inline .el-form-item {
    margin-right: 0;
  }
  ::v-deep .el-button--small {
    padding: 12px 15px;
    font-size: 14px;
  }
  .timestyle {
    width: 211px;
    padding-right: 20px;
  }
  .searchButton {
    margin-left: 10px;
  }
  ::v-deep .el-table__empty-block {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }
  .Owner {
    position: relative;
    // ::v-deep .el-icon-more:before {
    //   position: absolute;
    //   left: 160px;
    //   top: 13px;
    //   cursor: pointer;
    // }
    ::v-deep .custom-icon {
      position: absolute;
      left: 160px;
      top: 5px;
      width: 30px;
      height: 30px;
      line-height: 30px;
      text-align: center;
      display: inline-block;
      cursor: pointer;
    }
  }
}
</style>
